package com.bootdo.hotel.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.bootdo.hotel.dao.HotelRoomDayStatusDao;
import com.bootdo.hotel.domain.HotelRoomDayStatus;
import com.bootdo.hotel.service.HotelRoomDayStatusService;



@Service
public class HotelRoomDayStatusServiceImpl implements HotelRoomDayStatusService {
	@Autowired
	private HotelRoomDayStatusDao hotelRoomDayStatusDao;
	
	@Override
	public HotelRoomDayStatus get(Long id){
		return hotelRoomDayStatusDao.get(id);
	}

	@Override
	public HotelRoomDayStatus getByRoomIdAndDay(Long roomId, String day) {
		return hotelRoomDayStatusDao.getByRoomIdAndDay(roomId, day);
	}

	@Override
	public int updateStatusByRoomIdAndDay(Long roomId, String day, Integer status, Integer tempStatus) {
		return hotelRoomDayStatusDao.updateStatusByRoomIdAndDay(roomId, day, status,tempStatus);
	}

	@Override
	public int updateRoomTypeIdByRoomIdAndDay(Long roomId, String day, Long roomTypeId) {
		return hotelRoomDayStatusDao.updateRoomTypeIdByRoomIdAndDay(roomId,day,roomTypeId);
	}

	@Override
	public List<HotelRoomDayStatus> getByStartTimeAndEndTime(Long roomId, String startTime, String endTime) {
		return hotelRoomDayStatusDao.getByStartTimeAndEndTime(roomId, startTime, endTime);
	}

	@Override
	public List<HotelRoomDayStatus> getByHotelAndStartTimeAndEndTime(Long hotelId, String startTime, String endTime) {
		return hotelRoomDayStatusDao.getByHotelAndStartTimeAndEndTime(hotelId, startTime, endTime);
	}

	@Override
	public List<HotelRoomDayStatus> getByHotelRoomTypeIdAndStartTimeAndEndTime(Long roomTypeId, String startTime, String endTime) {
		return hotelRoomDayStatusDao.getByHotelRoomTypeIdAndStartTimeAndEndTime(roomTypeId,startTime,endTime);
	}

	@Override
	public Integer getRoomStockByDate(Long hotelId, Long roomTypeId, String day) {
		return hotelRoomDayStatusDao.getRoomStockByDate(hotelId,roomTypeId,day);
	}

	@Override
	public List<HotelRoomDayStatus> list(Map<String, Object> map){
		return hotelRoomDayStatusDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return hotelRoomDayStatusDao.count(map);
	}
	
	@Override
	public int save(HotelRoomDayStatus hotelRoomDayStatus){
	
		if(hotelRoomDayStatus.getId() != null) {
			return hotelRoomDayStatusDao.update(hotelRoomDayStatus);
		}else {
			return hotelRoomDayStatusDao.save(hotelRoomDayStatus);
		}		
	
		
	}
	
	@Override
	public int update(HotelRoomDayStatus hotelRoomDayStatus){
		return hotelRoomDayStatusDao.update(hotelRoomDayStatus);
	}
	
	@Override
	public int remove(Long id){
		return hotelRoomDayStatusDao.remove(id);
	}
	
	@Override
	public int batchRemove(Long[] ids){
		return hotelRoomDayStatusDao.batchRemove(ids);
	}
	
}
